<!--

    Copyright © 2016-2025 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<ng-container [formGroup]="windSpeedDirectionWidgetSettingsForm">
  <div class="tb-form-panel">
    <div class="tb-form-panel-title" translate>widgets.wind-speed-direction.wind-speed-direction-card-style</div>
    <tb-image-cards-select rowHeight="1:1"
                           [cols]="{columns: 3,
                                    breakpoints: {
                                      'lt-md': 2
                                    }}"
                           label="{{ 'widgets.wind-speed-direction.layout' | translate }}" formControlName="layout">
      <tb-image-cards-select-option *ngFor="let layout of windSpeedDirectionLayouts"
                                    [value]="layout"
                                    [image]="windSpeedDirectionLayoutImageMap.get(layout)">
        {{ windSpeedDirectionLayoutTranslationMap.get(layout) | translate }}
      </tb-image-cards-select-option>
    </tb-image-cards-select>
    <div class="tb-form-row space-between">
      <div>{{ (hasCenterValue ? 'widgets.wind-speed-direction.center-value' : 'widgets.wind-speed-direction.wind-direction') | translate }}</div>
      <div class="flex flex-row items-center justify-start gap-2">
        <tb-font-settings formControlName="centerValueFont"
                          [autoScale]="true"
                          [initialPreviewStyle]="{ color: windSpeedDirectionWidgetSettingsForm.get('centerValueColor').value?.color }"
                          [previewText]="centerValuePreviewFn">
        </tb-font-settings>
        <tb-color-settings formControlName="centerValueColor" settingsKey="{{ (hasCenterValue ? 'widgets.wind-speed-direction.center-value' : 'widgets.wind-speed-direction.wind-direction') | translate }}">
        </tb-color-settings>
      </div>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.wind-speed-direction.ticks-color' | translate }}</div>
      <tb-color-input asBoxInput
                      formControlName="ticksColor">
      </tb-color-input>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.wind-speed-direction.ticks-labels-type' | translate }}</div>
      <mat-form-field class="medium-width" appearance="outline" subscriptSizing="dynamic">
        <mat-select formControlName="directionalNamesElseDegrees">
          <mat-option [value]="true">
            {{ 'widgets.wind-speed-direction.directional-names' | translate }}
          </mat-option>
          <mat-option [value]="false">
            {{ 'widgets.wind-speed-direction.degrees' | translate }}
          </mat-option>
        </mat-select>
      </mat-form-field>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.wind-speed-direction.major-ticks' | translate }}</div>
      <div class="flex flex-row items-center justify-start gap-2">
        <tb-font-settings [class.!hidden]="!majorTicksFontEnabled"
                          formControlName="majorTicksFont"
                          [initialPreviewStyle]="{ color: windSpeedDirectionWidgetSettingsForm.get('majorTicksColor').value }"
                          [autoScale]="true"
                          previewText="N E S W">
        </tb-font-settings>
        <tb-color-input asBoxInput
                        formControlName="majorTicksColor">
        </tb-color-input>
      </div>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.wind-speed-direction.minor-ticks' | translate }}</div>
      <div class="flex flex-row items-center justify-start gap-2">
        <tb-font-settings [class.!hidden]="!minorTicksFontEnabled"
                          formControlName="minorTicksFont"
                          [initialPreviewStyle]="{ color: windSpeedDirectionWidgetSettingsForm.get('minorTicksColor').value }"
                          [autoScale]="true"
                          previewText="NE SE SW NW">
        </tb-font-settings>
        <tb-color-input asBoxInput
                        formControlName="minorTicksColor">
        </tb-color-input>
      </div>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.wind-speed-direction.arrow-color' | translate }}</div>
      <tb-color-input asBoxInput
                      formControlName="arrowColor">
      </tb-color-input>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widgets.background.background' | translate }}</div>
      <tb-background-settings formControlName="background">
      </tb-background-settings>
    </div>
    <div class="tb-form-row space-between">
      <div>{{ 'widget-config.card-padding' | translate }}</div>
      <mat-form-field appearance="outline" subscriptSizing="dynamic">
        <input matInput formControlName="padding" placeholder="{{ 'widget-config.set' | translate }}">
      </mat-form-field>
    </div>
  </div>
</ng-container>
